/*
 * util.c
 *
 *  Created on: Sep 8, 2012
 *      Author: Wanderer
 */

#include <cmath>
#include <float.h>

#define NEG_INF -DBL_MAX

static double sumLog(double a, double b) {
	if (a == NEG_INF) return b;
	else if (b == NEG_INF)
		return a;
	else if (a > b)
		return a + log(1 + exp(b - a));
	else
		return b + log(1 + exp(a - b));
}

